#!/usr/bin/env php


<?php

/// DEF
///////////////////////

$n = new gtkwindow();
$n->set_decorated(FALSE);
$n->connect_simple("destroy", array('gtk', 'main_quit'));
$n->set_position(gtk::WIN_POS_CENTER);

$fixed = new gtkfixed();
$n->add($fixed);

/// SKIN
///////////////////////

$pixbuf = gdkpixbuf::new_from_file('board.png');
$image = gtkimage::new_from_pixbuf($pixbuf);

list($pixmap, $mask) = $pixbuf->render_pixmap_and_mask(255);
$n->shape_combine_mask($mask, 0, 0);
$fixed->put($image, 0, 0);


/// SHELL EXEC
///////////////////////

#$ip = shell_exec("ifconfig | grep HWaddr | sed -e 's///g' ");
$mac = shell_exec("ifconfig eth0 | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}'");
$m = "ip link show eth0 | awk '/ether/ {print $2}'";
$tcp = shell_exec("ps axu");
$udp = shell_exec("netstat -lapute");


/// CANON
///////////////////////

$seek_x = 70;
$seek_y = 10;

$size_x = 73;
$size_y = 25;

########
# cours

$f_cours= new GtkFrame("iface Cours");
$f_cours->set_size_request(110, 70);
$fixed->put($f_cours, $seek_x, $seek_y);
$cours_textBuffer = new GtkTextBuffer();
$cours_textView = new GtkTextView();
#$textView->modify_bg(gtk::STATE_NORMAL, gdkColor::parse("#transparent"));

$cours_textBuffer->set_text($mac);
$cours_textView->set_buffer($cours_textBuffer);
$cours_textView->set_editable(false);
$fixed->put($cours_textView, 73, 25);


######
# dmz

$f_dmz= new GtkFrame("iface DMZ");
$f_dmz->set_size_request(110, 70);
$fixed->put($f_dmz, $seek_x, $seek_y+=119);
$textBuffer = new GtkTextBuffer();
$textView = new GtkTextView();
#$textView->modify_bg(gtk::STATE_NORMAL, gdkColor::parse("#transparent"));

$textBuffer->set_text($mac);
$textView->set_buffer($textBuffer);
$textView->set_editable(false);
$fixed->put($textView, $size_x, $size_y+=119);



######
# lab

$f_lab= new GtkFrame("iface LABO");
$f_lab->set_size_request(110, 70);
$fixed->put($f_lab, $seek_x, $seek_y+=119);
$lab_textBuffer = new GtkTextBuffer();
$lab_textView = new GtkTextView();
#$textView->modify_bg(gtk::STATE_NORMAL, gdkColor::parse("#transparent"));

$lab_textBuffer->set_text($mac);
$lab_textView->set_buffer($lab_textBuffer);
$lab_textView->set_editable(false);
$fixed->put($lab_textView, $size_x, $size_y+=119);

######
# wan

$f_wan = new GtkFrame("iface WAN");
$f_wan->set_size_request(110, 70);
$fixed->put($f_wan, $seek_x, $seek_y+=119);
$wan_textBuffer = new GtkTextBuffer();
$wan_textView = new GtkTextView();
#$textView->modify_bg(gtk::STATE_NORMAL, gdkColor::parse("#transparent"));

$wan_textBuffer->set_text($mac);
$wan_textView->set_buffer($wan_textBuffer);
$wan_textView->set_editable(false);
$fixed->put($wan_textView, $size_x, $size_y+=119);


$n->show_all();
gtk::main();

?>
